<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
include_once './ConvenioClass.php';
include_once '../view/component/datagrid/TableGridClass.php';
include_once '../view/class/TemplateClass.php';

$convenenteEncontrados = ConvenioClass::PESQUISAR($_POST['convenente'],$_POST['numero_do_convenio'],$_POST['numero_do_processo']);
print_r($convenenteEncontrados);


$tableHead = "
    <thead>
      <tr>
      <td>Número</td><td>Processo</td><td>Convenente</td><td>Descrição</td><td>Ações</td>
      </tr>
    </thead>
      ";

$convenente = new ArrayIterator($convenenteEncontrados);
$tableContent = "<tbody>";
while ($convenente->valid()):
    $tableContent = $tableContent . "<tr>";
    $tableContent = $tableContent .
            "<td>" . $convenente->current()->numero . "</td>" .
            "<td>" . $convenente->current()->processo . "</td>" .
            "<td>" . $convenente->current()->convenente . "</td>".
            "<td>" . $convenente->current()->descricao_objeto . "</td>".
            "<td style=\"text-align:center;\">" 
            .TemplateClass::EDIT_BUTTON("EditarUsuario.php?id=".$convenente->current()->cod_convenio,"Editar Convênio")
            ." ".TemplateClass::ACCOUNTABILITY_BUTTON("../../model/UsuarioAtivarDesativarController.php?id=".$convenente->current()->cod_convenio,"Prestar Contas")
            ." ".TemplateClass::LOOK_BUTTON("VisualizarUsuario.php?id=".$convenente->current()->cod_convenio,"Visualizar Convênio")  . "</td>";
    $tableContent = $tableContent . "</tr>";
    $convenente->next();

endwhile;

$tableContent=$tableContent."</tbody>";

$content=$tableHead.$tableContent;

$tbGrid= new TableGridClass();

$tbGrid->setTableTitle("Resultado Pesquisa");
$tbGrid->setTableContent($content);
$tbGrid->keepTableGrid();


header('Location: ' . $_SERVER['HTTP_REFERER']);


